package com.tianqi.common.enums;

/**
 * 六爻参数类型枚举
 *
 * @author zhangzedi
 * @date 2023/8/19 16:27
 **/
public enum LiuYaoReqEnum {
	SANSHU_A(1, "三数起卦规则A"),
	SANSHU_B(2, "三数起卦规则B"),
	SHUANGSHU_A(3, "双数起卦规则A"),
	SHUANGSHU_B(4, "双数起卦规则B"),
	YINGBI(5, "硬币起卦"),
	TONGQIAN(6, "铜钱起卦");


	/**
	 * 类型值
	 */
	private Integer code;

	/**
	 * 名称
	 */
	private String name;

	LiuYaoReqEnum(Integer code, String name) {
		this.code = code;
		this.name = name;
	}

	public Integer getCode() {
		return code;
	}

	/**
	 * 获取起卦类型
	 *
	 * @param code
	 * @return
	 */
	public static LiuYaoReqEnum findQiGuaType(Integer code) {
		LiuYaoReqEnum[] values = LiuYaoReqEnum.values();
		for (LiuYaoReqEnum liuYaoReqEnum : values) {
			if (code.equals(liuYaoReqEnum.getCode())) {
				return liuYaoReqEnum;
			}
		}
		return null;
	}

}
